# 主系统菜单 负责开始 结束 功能选择
from func import bank_info
from func import check_flow
from func import recharge
from func import transfer_money
from func import withdraw_money
from func import login
from func import register

'''func文件夹下__init__下的内容'''


# from bank_main import bank_info  # 卡号，余额，流水
# from bank_main import check_flow  # 查看余额
# from bank_main import recharge  # 充值
# from bank_main import transfer_money  # 转账
# from bank_main import withdraw_money  # 取款
# from login_register import login  # 登录
# from login_register import register  # 注册

def quit_system():
    return False, 'break'


func_menu = '''
===================用户功能菜单=====================
                  1.注册
                  2.登陆
                  3.取款
                  4.转账
                  5.充值余额
                  6.查看余额
                  7.查看银行信息(查看自己的卡号、余额、流水信息)
                  8.退出系统
======================欢迎使用=======================
'''
func_dict = {
    1: register,
    2: login,
    3: withdraw_money,
    4: transfer_money,
    5: recharge,
    6: check_flow,
    7: bank_info,
    8: quit_system
}


def main_system():
    # 【1】打印功能菜单
    while True:
        print(func_menu)
        func_id = input("请输入功能ID :>>>> ").strip()
        if not func_id.isdigit():
            print(f'{func_id} :>>>> 非法字符')
            continue
        func_id = int(func_id)
        if func_id not in func_dict.keys():
            print(f"{func_id} :>>>> 不存在该功能!")
            continue
        func = func_dict.get(func_id)
        flag, msg = func()
        if flag:
            print(msg)
        elif not flag and msg == 'break':
            print(f"欢迎下次使用!再见!")
            break
        else:
            print(msg)
            continue


main_system()
